//
//  MyOrderViewController.m
//  MyNewProject
//
//  Created by sun on 2019/1/29.
//  Copyright © 2019 sun. All rights reserved.
//


#import "MyOrderViewController.h"
#import "OrderDetailViewController.h"

#import "XXPageTabView.h"
#import "XXPageTabItemLable.h"
@interface MyOrderViewController () <XXPageTabViewDelegate>
@property (nonatomic, strong) XXPageTabView *pageTabView;

@end

@implementation MyOrderViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = SKRGBColor(237, 237, 237);

    self.gk_navTitle = @"我的订单";
    
    OrderDetailViewController *vc1 = [OrderDetailViewController new];
    OrderDetailViewController *vc2 = [OrderDetailViewController new];
    OrderDetailViewController *vc3 = [OrderDetailViewController new];
    OrderDetailViewController *vc4 = [OrderDetailViewController new];
    OrderDetailViewController *vc5 = [OrderDetailViewController new];
    
    [self addChildViewController:vc1];
    [self addChildViewController:vc2];
    [self addChildViewController:vc3];
    [self addChildViewController:vc4];
    [self addChildViewController:vc5];
    vc1.type = BuyTypeDefault;
    vc1.status = OrderStatusReadyPay;
    vc2.type = BuyTypeDefault;
    vc2.status = OrderStatusReadySend;
    vc3.type = BuyTypeDefault;
    vc3.status = OrderStatusSended;
    vc4.type = BuyTypeDefault;
    vc4.status = OrderStatusSigned;
    vc5.type = BuyTypeDefault;
    vc5.status = OrderStatusRepayedPass;
    
    //支持网易云音乐，今日头条，微博等切换栏效果
    self.pageTabView = [[XXPageTabView alloc] initWithChildControllers:self.childViewControllers childTitles:@[@"待付款",@"待发货",@"待收货",@"已签收", @"售后"]];
    self.pageTabView.frame = CGRectMake(0, SKTopBar_Height, SCREEN_WIDTH, SCREENH_HEIGHT-SKTopBar_Height);
    self.pageTabView.delegate = self;
    self.pageTabView.tabSize = CGSizeMake(0, 47);
    self.pageTabView.titleStyle = XXPageTabTitleStyleDefault;
    self.pageTabView.indicatorStyle = XXPageTabIndicatorStyleDefault;
    self.pageTabView.maxNumberOfPageItems = 5;
    
    self.pageTabView.tabItemFont = SKFONT_Semibold(15.0);
    
    self.pageTabView.indicatorHeight = 3;
    self.pageTabView.indicatorWidth = 44;
    self.pageTabView.unSelectedColor = SKColorWithHex(0x9999999);
    self.pageTabView.selectedColor = SKColorWithHex(0x444444);

    self.pageTabView.indicatorView.backgroundColor = SKColorWithHex(0x000000);
    //    self.pageTabView.tabSize = CGSizeMake(self.view.bounds.size.width-30, 0);
    
    self.pageTabView.selectedTabIndex = self.selectedCondition;
    [self.view addSubview:self.pageTabView];
    self.view.backgroundColor = [UIColor lightGrayColor];
    
    OrderDetailViewController *test = self.pageTabView.childControllers[ self.pageTabView.selectedTabIndex];
    [test getData];
}

- (void)pageTabViewDidEndChange {
    NSLog(@"#####%ld", self.pageTabView.selectedTabIndex);
    OrderDetailViewController *test = self.pageTabView.childControllers[ self.pageTabView.selectedTabIndex];
    [test getData];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
